package com.dingwei.superiordiary.adapter.easyViewHolder;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.dingwei.superiordiary.R;
import com.dingwei.superiordiary.app.MyApplication;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.lihao.baselibrary.base.BaseActivity;
import com.lihao.baselibrary.base.URLS;
import com.lihao.baselibrary.utils.DisplayUtil;
import com.lihao.baselibrary.utils.ScreenUtils;

import org.xutils.common.util.DensityUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by lihao on 2017/9/12.
 */

public class ImgHolder extends BaseViewHolder<String> {

    @Bind(R.id.img)
    ImageView img;

    public ImgHolder(ViewGroup parent) {
        super(parent, R.layout.item_img1);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(String data) {
        super.setData(data);
        LinearLayout.LayoutParams lp1 = new LinearLayout.LayoutParams((ScreenUtils.getScreenWidth(BaseActivity.context)- DisplayUtil.dip2px(BaseActivity.context,52))/3 ,
                (ScreenUtils.getScreenWidth(BaseActivity.context)- DisplayUtil.dip2px(BaseActivity.context,52))/3);
        img.setLayoutParams(lp1);
        Glide.with(BaseActivity.context)
                .load(data)
                .apply(MyApplication.options)
                .into(img);
    }
}
